package com.code.day17;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo16Iterator {
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>();
        list.add("古力娜扎");
        list.add("迪丽热巴");
        list.add("马尔扎哈");
        list.add("哈妮克孜");

        Iterator<String> iterator = list.iterator();
        while(iterator.hasNext()){
            String next = iterator.next();
            System.out.println(next);
        }
    }
}
